package org.dna.uimodel;

import java.util.List;

import org.dna.metronomo.persistence.Activity;
import org.dna.metronomo.persistence.Job;
import org.dna.metronomo.persistence.TimePeriod;

/**
 * Internal usage Decorator class to wrap an activity and make it selectable.
 *
 * */
public final class SelectableActivity extends Activity {
	//NB all setter must be redefined else the changes doesnt' go in the wrapped
	//object
	
	private static final long serialVersionUID = 5979664854609004460L;
	private Activity m_orig;
	private boolean selected = false;
	
	public SelectableActivity(Activity orig) {
		super();
		m_orig = orig;
	}
	
	public boolean isSelected() {
		return selected;
	}

	void setSelected(boolean selected) {
		this.selected = selected;
	}
	
	@Override
	public int getId() {
		return m_orig.getId();
	}

	@Override
	public List<Job> getJobs() {
		return m_orig.getJobs();
	}

	@Override
	public String getDescription() {
		return m_orig.getDescription();
	}
	
	public void setDescription(String descr) {
		m_orig.setDescription(descr);
	}
	
	@Override
	public void setName(String name) {
		m_orig.setName(name);
	}

	@Override
	public String getName() {
		return m_orig.getName();
	}

	@Override
	public TimePeriod getEffort() {
		return m_orig.getEffort();
	}
	
	@Override
	public String toString() {
        return String.format("sel=%b %s", selected, m_orig);
	}

}
